export default {
  data() {
    return {
      disabled: false,
      text: "get verification code" // "获取验证码"
    };
  },
  methods: {
    sendCode() {
      if (this.disabled) return;
      this.disabled = true;
      let n = 60;
      this.text = "last " + n + "s"; // 剩余
      const run = setInterval(() => {
        n = n - 1;
        if (n < 0) {
          clearInterval(run);
        }
        this.text = "last " + n + "s"; // 剩余
        if (this.text < "last " + 0 + "s") { // 剩余
          this.disabled = false;
          this.text = "Reacquire"; // 重新获取
        }
      }, 1000);
    }
  }
};